package com.youdianda.controller;


import com.youdianda.dto.SysMenuDto;
import com.youdianda.dto.SysMenuUpdateDto;
import com.youdianda.entity.SysMenu;
import com.youdianda.result.Result;
import com.youdianda.service.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 * 菜单表 前端控制器
 * </p>
 *
 * @author sdy
 * @since 2023-05-15
 */
@RestController
@RequestMapping("/sys_menu")
public class SysMenuController {
    @Autowired
    private ISysMenuService iSysMenuService;


    /**
     * 新增菜单
     * @param
     * @return
     */
    @PostMapping("/add")
    public Result  sysMenuAdd(@RequestBody SysMenuDto sysMenu){return iSysMenuService.sysMenuAdd(sysMenu);}

    /**
     * 查看所有菜单
     * @return
     */
    @GetMapping ("/allData")
    public Result sysMenuAllData(){return iSysMenuService.sysMenuAllData();}

    /**
     * 查询菜单详情 根据id查询
     * @return
     */
    @GetMapping("/rowInfo")
    public Result sysMenuRowlnfo( Integer id){return iSysMenuService.sysMenuRowlnfo(id);}

    /**
     * 修改单条数据
     * @param dto
     * @return
     */
    @PostMapping("/update")
    public Result sysMenuUpdate(@RequestBody SysMenuUpdateDto dto){return iSysMenuService.sysMenuUpdate(dto);}

    /**
     * 根据id删除
      * @param id
     * @return
     */
    @GetMapping("/del")
    public Result deleteDel(Integer id){
        return iSysMenuService.deleteDel(id);}



}

